/**
 * @param {number[][]} grid
 * @return {boolean}
 */
var checkXMatrix = function (grid) {
  let len = grid.length
  for (let i = 0; i < len; i++) {
    for (let j = 0; j < len; j++) {
      if (i == j || i + j == (len - 1)) {
        if (grid[i][j] == 0) return false
      } else {
        if (grid[i][j] != 0) return false
      }
    }
  }
  return true
};